﻿using System.Collections.Generic;

namespace Game.FlowField.Input
{
    public static class Operations
    {
        private static Queue<IOperationBase> s_Operations = new Queue<IOperationBase>();

        public static void Enqueue(IOperationBase operation)
        {
            s_Operations.Enqueue(operation);
        }

        public static bool TryDequeue(out IOperationBase operation)
        {
            operation = default;

            if (s_Operations.Count == 0)
                return false;

            operation = s_Operations.Dequeue();
            return true;
        }

        public static void ClearUp()
        {
            if (s_Operations != null)
            {
                s_Operations.Clear();
            }
        }
    }
}